package secondary_classes;
import java.util.Comparator;





public class TradeComparatorTime implements Comparator<Order> {

	@Override
	public int compare(Order arg0, Order arg1) {
		int result = 0;

		if (arg0.getDate().before(arg1.getDate())) {
			result = -1;
		} else if (arg0.getDate().after(arg1.getDate())) {
			result = 1;
		} else { // if dates are the same, check time
			if (arg0.getTime().before(arg1.getTime())) {
				result = -1;
			} else if (arg0.getTime().after(arg1.getTime())) {
				result = 1;
			} else {
				result = 1;
			}
		}
		return result;
	}



}
